home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Views / WakeUpAndGoToSleep-1 / Project Data next >
Encoding:
Text File  |  1994-03-03  |  645 b   |  30 lines  |  [TEXT/ttxt]

  1. /*
  2.  
  3.   Copyright: © Apple Computer, Inc. 1993
  4.   author: Mike Engber
  5.  
  6.   WakeUpAndGoToSleep v1
  7.  
  8. This sample demos how to detect when the Newton wakes up. The basic idea is
  9. to spawn a deferred action right before the Newton goes to sleep. The
  10. action runs when the Newton wakes up.
  11.  
  12. This sample replaces WakeUpTimeToDie which used a more complex method
  13. involving idle scripts.
  14.  
  15.  
  16.  */
  17.  
  18.  
  19. constant kAppSymbol := '|WakeUpAndGoToSleep:PIEDTS|;
  20.  
  21. InstallScript := func(partFrame)
  22. begin
  23.   AddDeferredAction(func() AddPowerOffHandler(GetRoot().(kAppSymbol)),[]);
  24. end;
  25.  
  26. RemoveScript := func(partFrame)
  27. begin
  28.   RemovePowerOffHandler(GetRoot().(kAppSymbol))
  29. end;
  30.